/*
 ============================================================================
 Name		: FbSoftKeyBar.h
 Author	  : ceze
 Version	 : 1.0
 Copyright   : FlashBox for ver.Zhongyou(���ʰ�)
 Description : CFbSoftKeyBar declaration
 ============================================================================
 */

#ifndef FBSOFTKEYBAR_H
#define FBSOFTKEYBAR_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <coecntrl.h>

// CLASS DECLARATION

class MSoftKeyObserver
{
public:
	virtual void SoftKeyEvent (TInt aKeyId ) = 0;
};

/**
 *  CFbSoftKeyBar
 * 
 */
class CFbSoftKeyBar : public CCoeControl
{
public:
	// Constructors and destructor

	/**
	 * Destructor.
	 */
	~CFbSoftKeyBar ();

	/**
	 * Two-phased constructor.
	 */
	static CFbSoftKeyBar
			* NewL (const TRect &aRect, CCoeControl *pParent, MSoftKeyObserver *pObserver );

	/**
	 * Two-phased constructor.
	 */
	static CFbSoftKeyBar
			* NewLC (const TRect &aRect, CCoeControl *pParent, MSoftKeyObserver *pObserver );

	/**
	 * Left软键文字&id
	 */
	void SetLeftKeyL (const TInt &keyId, const TInt &aResId );

	/**
	 * Right Key
	 */
	void SetRightKeyL (const TInt &keyId, const TInt &aResId );

	/*
	 * From CoeControl,
	 * 按键事件接收处理
	 */
	TKeyResponse OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType );
	
public:
	enum EShow_type
	{
		EShowTime = 0,
		EShowInfoText,
		EShowPageNums
	};
	
//	void SetShowType(const TInt &aShowType);
	void ShowTime();
	void ShowInfomation(const TDesC &aInfoText);
	void ShowInfomation(const TInt aInfoId);
	void ShowPageNumbers(TInt aCurPageIndex, TInt aTotlePages);

private:
	
	/**
	 * Constructor for performing 1st stage construction
	 */
	CFbSoftKeyBar (MSoftKeyObserver *pObserver );

	/**
	 * EPOC default constructor for performing 2nd stage construction
	 */
	void ConstructL (const TRect &aRect, CCoeControl *pParent );

protected:
	/**
	 * From CoeControl,SizeChanged.
	 */
	void SizeChanged ();

	/**
	 * From CCoeControl,Draw.
	 */
	void Draw (const TRect& aRect ) const;

private:
	CFbsBitmap *m_pSoftKeyBar;

	//按键文字
	HBufC *m_pSoftLeftText;
	HBufC *m_pSoftRightText;
	//按键id
	TInt m_leftKeyId;
	TInt m_rightKeyId;
	
	//当前显示类别
	EShow_type m_ECurShowType;
	
	//当前时间
	HBufC* m_CurrentTime;
	CPeriodic*	iPeriodic;
	
	//当前显示的文本信息
	HBufC* m_CurInfoText;
	TInt	m_textOffset;
	
	//当前显示的页数
	HBufC* m_CurPageBuf;
	
	static TInt DrawCallback(TAny* pInst);

	MSoftKeyObserver *m_pObserver;

};

#endif // FBSOFTKEYBAR_H
